package mess;

import java.util.Arrays;

public class LeeCode_27_second {
    public static void main(String[] args) {
        System.out.println(removeElement(new int[]{3,2,2,3}, 3));
    }
    private static int removeElement(int[] nums, int val) {
        if (nums == null || nums.length == 0)
            return 0;
        int temp = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != val){
                nums[temp] = nums[i];
                temp++;
            }
        }
        System.out.println(Arrays.toString(nums));
        return temp;
    }
}
